<template>
  <div>
    <h2>approvals</h2>
    <div>
      approvals
      <UploadExcel :on-success="handleSuccess" :before-upload="beforeUpload" />
    </div>
  </div>
</template>

<script>
import UploadExcel from '@/components/UploadExcel'
export default {
  name: 'Approvals',
  components: {
    UploadExcel
  },
  methods: {
    beforeUpload(file) {
      console.log('file:', file)
      const isLt1M = file.size / 1024 / 1024 < 1
      if (isLt1M) {
        return true
      }
      this.$message({
        message: 'Please do not upload files larger than 1m in size.',
        type: 'warning'
      })
      return false
    },
    handleSuccess({ results, header }) {
      console.log('results:', results)
      console.log('header:', header)
    }
  }
}
</script>

<style></style>
